﻿using CodeIn.Core.Modules;
using CodeIn.Ui;

namespace CodeIn.Modules.Ui.Term {
	public class Term : BaseModule {
		private TermView view;

		protected override void InitializeOverride() {
		}

		protected override bool CanExecuteOverride(string[] args) {
			if (view != null)
				return False("Terminal is already loaded.");
			return true;
		}

		protected override void ExecuteOverride(string[] args) {
			var panel = UiHelper.CreateAndShowPanel("Terminal", PanelSide.BOTTOM, () => {
				view = new TermView();
				return view;
			});

			panel.CloseRequested += (s, e) => {
				e.Handled = true;
			};
		}
	}
}
